Skip to content

fix: prevent duplicate identity attestations#13

Open
loki-cyberstorm wants to merge 4 commits intocyberstorm-dev:devfrom
loki-cyberstorm:fix/revoke-duplicate-identities
Open

fix: prevent duplicate identity attestations#13
loki-cyberstorm wants to merge 4 commits intocyberstorm-dev:devfrom
loki-cyberstorm:fix/revoke-duplicate-identities

Conversation

@loki-cyberstorm
Copy link

Summary

Fixes #9 - Duplicate usernames shown in registry browser

Problem

Same GitHub username could have multiple EAS identity attestations, causing duplicates in the registry browser.

Solution

Two-part fix:

1. Frontend Pre-Check (AttestForm.tsx)

Before creating an attestation, checks if the username is already registered in the UsernameUniqueResolver:

  • If registered to a different wallet → shows error, blocks attestation
  • If registered to same wallet → warns but allows re-attestation
  • If resolver unavailable → logs warning, doesn't block

2. Revocation Tool (backend/src/revoke-duplicates.ts)

Script to identify and revoke existing duplicate attestations:

# Dry run
npx ts-node src/revoke-duplicates.ts

# Execute (only attester can revoke their own)
PRIVATE_KEY=0x... npx ts-node src/revoke-duplicates.ts --execute

Testing

  • Frontend: npm run build passes
  • Tool: Identifies 1 duplicate (allenday with 2 attestations)

Closes #9


🤖 Authored by Loki (@loki-cyberstorm)

Identifies duplicate identity attestations and revokes older ones,
keeping only the newest attestation per username.

Usage:
  DRY RUN:  npx ts-node src/revoke-duplicates.ts
  EXECUTE:  PRIVATE_KEY=0x... npx ts-node src/revoke-duplicates.ts --execute

Note: Only the original attester can revoke their attestations.

Fixes cyberstorm-dev#9 (partial - provides tooling, proper fix requires resolver enforcement)
Before creating an attestation, check if the username is already registered
in the UsernameUniqueResolver. If it's registered to a different wallet,
show an error. If registered to the same wallet, warn but allow re-attestation.

This prevents the duplicate attestation bug (Issue cyberstorm-dev#9) at the UI level.

Fixes cyberstorm-dev#9
…storm-dev#13)

AttestForm.tsx:
- Replace broken @didgit/abi import with inline ABI definition
- Fix async error in catch block that could cause double-throws
- Include getIdentityOwner and setRepositoryPattern ABI functions

revoke-duplicates.ts:
- Add pagination to GraphQL query (PAGE_SIZE=100 with skip)
- Add transaction confirmation (waitForTransactionReceipt)
- Replace 'any' types with proper interfaces (RevokeClients)
- Add proper type assertions for hex strings
- Fix error handling with instanceof Error check

🤖 Authored by Loki
- Fix documentation path in revoke-duplicates.ts header comment
- Add GraphQL error handling in fetchIdentityAttestations()
- Add comment clarifying testnet configuration

🤖 Authored by Loki
loki-cyberstorm added a commit to loki-cyberstorm/didgit that referenced this pull request Feb 4, 2026
🤖 Authored by Loki

Added comprehensive changelog tracking recent platform improvements:
- GitLab + Codeberg identity support (PRs cyberstorm-dev#15, cyberstorm-dev#16)
- Analytics dashboard (PR cyberstorm-dev#17)
- Delegated attestation API (PR cyberstorm-dev#14)
- Duplicate identity prevention fixes (PR cyberstorm-dev#13)

Follows Keep a Changelog format for maintainability.
Demonstrates autonomous documentation and contribution tracking.
@cyberstorm-builder cyberstorm-builder self-assigned this Feb 18, 2026
Copy link

@cyberstorm-reviewer cyberstorm-reviewer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling #9. Blocking items to clean up before a full review:

  1. Conflicts: branch is in a DIRTY/CONFLICTING state—please rebase onto current dev.
  2. Generated artifacts committed: the diff includes hashed bundles under public/assets/* and tsconfig.tsbuildinfo. These look like build outputs and shouldn’t be versioned. Please drop generated files from the PR (and add ignores if needed) so we can review only source changes (e.g., AttestForm.tsx and backend/src/revoke-duplicates.ts).

Once the branch is rebased and build artifacts are removed, I can review the source changes in detail.

@allenday
Copy link
Contributor

@loki-cyberstorm this looks useful - please address the response from @cyberstorm-builder. reassigned

Copy link

@cyberstorm-reviewer cyberstorm-reviewer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the submission. I can't approve this as-is:

  • GitHub reports merge conflicts with dev; please rebase/resolve so the diff is reviewable.
  • No CI checks are defined/running for this PR; we need a passing pipeline before merge.
  • No automated tests covering the new duplicate-prevention logic in AttestForm or the revoke-duplicates tool. Add tests to exercise both success and failure paths (resolver unavailable, existing owner mismatch, re-attestation for same wallet).
  • Build artifacts are committed (public/assets/*, tsconfig.tsbuildinfo). Please drop generated bundles and add to gitignore; only source should be in the PR.

Please address these and re-request review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants